<template>
  <div>
    <el-container>
      <el-container>
        <el-aside width="200px">
          <el-card :body-style="{ padding: '0px' }">
            <img :src="this.$http.uri + form.img" class="image">
            <div style="padding: 14px;">
              <div>{{form.nameCn}}</div>
              <div class="bottom clearfix">
                <time class="time">{{ form.nameEn }}</time>
              </div>
            </div>
          </el-card>
        </el-aside>
        <el-container>
          <el-main>
            <div style="white-space: pre-wrap;">{{form.descEn}}</div>
          </el-main>
          <el-main>
            <div style="white-space: pre-wrap;">{{form.descCn}}</div>
          </el-main>
        </el-container>
      </el-container>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'WitcherCharsDetail',
  data() {
    return {
      preUrl: "/witcher3/characters",
      detailUrl: "/detail", // 详情
      form: { // 表单数据
        id: '',
        nameEn: '',
        nameCn: '',
        descEn: '',
        descCn: '',
        img: '',
      },
    }
  }
  ,created() {

  }
  ,mounted(){
    // console.log("this.$route.params.id = ", this.$route.params.id);
    this.detailData(this.$route.params.id);
  }
  ,methods: {
    // 详情数据
    async detailData(id){
      let param = {
        id: id
      };
      let res = await this.$http.post(this.preUrl + this.detailUrl, param);
      if(res.code === 1){
        Object.assign(this.form, res.data );
      }
    },
  }
}
</script>
<style>
.image {
  width: 100%;
  display: block;
}
.bottom {
  margin-top: 13px;
  line-height: 12px;
}

.el-aside {
  /* background-color: #D3DCE6; */
  color: #333;
  text-align: center;
  /* line-height: 200px; */
}

.el-main {
  /* background-color: #E9EEF3; */
  color: white;
  text-align: left;
  width: 50%;
}
</style>
